//
//  MinePostsHeaderView.m
//  JiaoX
//
//  Created by yinqy on 15/4/8.
//  Copyright (c) 2015年 北京娇羞科技有限公司. All rights reserved.
//

#import "MinePostsHeaderView.h"
#import "LeftLineView.h"

@interface MinePostsHeaderView()
{
    UILabel *_sentenceLabel;//不是vip时 等级说明
    UIView *_spliteView;
    LeftLineView *_leftLineView;

    NSString *_url;
}


@end

@implementation MinePostsHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setWidth:JXScreenW];
        [self setBackgroundColor:[UIColor whiteColor]];
        
        self.userInfoView = [[UserInfoTitleView alloc]init];
        [self addSubview:self.userInfoView];
        
        _sentenceLabel = [[UILabel alloc]init];
        [_sentenceLabel setFont:SYS_FONT(SCALEX(12))];
        [_sentenceLabel setTextColor:JXColor(102, 102, 102)];
        [self addSubview:_sentenceLabel];
        
        _spliteView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.userInfoView.frame), JXScreenW, 10)];
        [_spliteView setBackgroundColor:JXColor(238, 238, 238)];
        [self addSubview:_spliteView];
        
        _leftLineView = [[LeftLineView alloc]initWithTitleFontSize:SCALEX(14)];
        [_leftLineView setX:10];
        [_leftLineView setY:CGRectGetMaxY(_spliteView.frame)+15];
        [_leftLineView setText:@"我的帖子"];
        [self addSubview:_leftLineView];
        
        [self setHeight:CGRectGetMaxY(_leftLineView.frame)];
    }
    return self;
}

-(void)setUrl:(NSString *)url{
    _url = url;
}


-(void)setSentence:(NSString *)sentence{
    if (ISBLANK(sentence)) {
        return;
    }
    [_sentenceLabel setText:sentence];
    [_sentenceLabel setHeight:_sentenceLabel.font.lineHeight];
    [_sentenceLabel setY:CGRectGetMaxY(_userInfoView.frame)];
    [_sentenceLabel setX:10+SCALEX(39)+5];
    [_sentenceLabel setWidth:JXScreenW-_sentenceLabel.x-10];
    [_sentenceLabel setHidden:NO];
    //调整下面view的位置
    
    [_spliteView setY:CGRectGetMaxY(_sentenceLabel.frame)+10];
    [_leftLineView setY:CGRectGetMaxY(_spliteView.frame)+15];
    [self setHeight:CGRectGetMaxY(_leftLineView.frame)];
}

@end
